//
//  DKBankInfoInputView.m
//  DanKU
//
//  Created by 吴斌 on 2023/11/12.
//

#import "DKBankInfoInputView.h"
@interface DKBankInfoInputView()
@property (nonatomic,strong) UIView *dk_baseInfoView;
@property (nonatomic, strong)UILabel * dk_baseInfoHeadLab;
@property (nonatomic, strong)UITextField * dk_baseInfoField;
@end
@implementation DKBankInfoInputView
-(instancetype)init{
    if(self == [super init]){
        [self dk_addSubView];
    }
    return self;
}
- (void)dk_addSubView{
    self.dk_baseInfoHeadLab = [[UILabel alloc] init];
    self.dk_baseInfoHeadLab.textColor = DK_Hex(@"#999999");
    self.dk_baseInfoHeadLab.font = DK_FONT_Regular(14);
    self.dk_baseInfoHeadLab.text = @"Bank";
    [self addSubview:self.dk_baseInfoHeadLab];
    [self.dk_baseInfoHeadLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(DK_IsWidthScale(0)));
        make.top.equalTo(@(DK_IsWidthScale(0)));
        make.height.equalTo(@(DK_IsWidthScale(20)));
    }];
    self.dk_baseInfoView = [[UIView alloc] init];
    self.dk_baseInfoView.layer.cornerRadius = DK_IsWidthScale(14);
    self.dk_baseInfoView.layer.borderWidth = 0;
    self.dk_baseInfoView.layer.borderColor = DK_Hex(@"#4566FF").CGColor;
    self.dk_baseInfoView.backgroundColor = DK_Hex(@"#F7F7F8");
    [self addSubview:self.dk_baseInfoView];
    [self.dk_baseInfoView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(DK_IsWidthScale(0)));
        make.right.equalTo(@(-DK_IsWidthScale(0)));
        make.top.equalTo(self.dk_baseInfoHeadLab.mas_bottom).offset(DK_IsWidthScale(10));
        make.bottom.equalTo(@(-DK_IsWidthScale(10)));
    }];
    self.dk_baseInfoField = [[UITextField alloc] init];
    self.dk_baseInfoField.font = DK_FONT_Medium(14);
    self.dk_baseInfoField.placeholder = @"Please enter";
//    self.dk_baseInfoField.delegate = self;
    [self.dk_baseInfoField addTarget:self action:@selector(fieldEditChange) forControlEvents:UIControlEventEditingChanged];
    [self.dk_baseInfoView addSubview:self.dk_baseInfoField];
    [self.dk_baseInfoField mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(DK_IsWidthScale(15)));
        make.right.equalTo(@(-DK_IsWidthScale(0)));
        make.top.equalTo(@(DK_IsWidthScale(0)));
        make.height.equalTo(@(DK_IsWidthScale(50)));
    }];
}
- (void)fieldEditChange{
    if(self.InputScuessBlock){
        self.InputScuessBlock();
    }
}
- (void)changeErrorStepStatusInput:(BOOL)isError{
    if(isError){
        self.dk_baseInfoView.layer.borderWidth = 0.5;
        self.dk_baseInfoView.layer.borderColor = DK_Hex(@"#ED4342").CGColor;
    }else{
        self.dk_baseInfoView.layer.borderWidth = 0;
    }
}

- (NSString *)getStepStatusInput{
    return self.dk_baseInfoField.text;
}

@end
